<?php

use yii\helpers\Html;
use yii\grid\GridView;
use backend\components\ListWidget;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\DoctorSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Doctors';
$this->params['breadcrumbs'][] = $this->title;
$this->registerCssFile('/uploadify/uploadify.css');
$this->registerJsFile('/uploadify/jquery.uploadify.min.js',['position'=>\yii\web\View::POS_HEAD,'depends'=>'backend\assets\AppAsset']);
?>

<div class="admin-content">
    <div class="admin-content-body">
        <div class="am-cf am-padding am-padding-bottom-0">
            <!--调用列表小部件 <?= ListWidget::widget() ?> -->
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">医生列表</strong> / <small>Table</small></div>
        </div>
        <hr>
        <div class="am-g">
            <div class="am-u-sm-12 am-u-md-6">
                <div class="am-btn-toolbar">
                    <div class="am-btn-group am-btn-group-xs">
                        <button type="button" class="am-btn am-btn-default" id="doc-add"><span class="am-icon-plus"></span> 新增</button>
                        <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 保存</button>
                        <button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 审核</button>
                        <button type="button" class="am-btn am-btn-default"><span class="am-icon-trash-o"></span> 删除</button>
                    </div>
                </div>
            </div>
            <div class="am-u-sm-12 am-u-md-3">
                <div class="am-form-group">
                    <select data-am-selected="{btnSize: 'sm'}">
                        <option value="option1">所有类别</option>
                        <option value="option2">IT业界</option>
                        <option value="option3">数码产品</option>
                        <option value="option3">笔记本电脑</option>
                        <option value="option3">平板电脑</option>
                        <option value="option3">只能手机</option>
                        <option value="option3">超极本</option>
                    </select>
                </div>
            </div>
            <div class="am-u-sm-12 am-u-md-3">
                <div class="am-input-group am-input-group-sm">
                    <input type="text" class="am-form-field">
          <span class="am-input-group-btn">
            <button class="am-btn am-btn-default" type="button">搜索</button>
          </span>
                </div>
            </div>
        </div>

        <div class="am-g">
            <div class="am-u-sm-12">
                    <table class="am-table am-table-striped am-table-hover table-main">
                        <thead>
                        <tr>
                            <th class="table-check"><input type="checkbox" /></th>
                            <th class="table-id">ID</th>
                            <th class="table-title">医生姓名</th>
                            <th class="table-title">用户名称</th>
                            <th class="table-type">职务名称</th>
                            <th class="table-author am-hide-sm-only">应约次数</th>
                            <th class="table-date am-hide-sm-only">关注次数</th>
                            <th class="table-set">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php foreach($doctorData as $k => $v){ ?>
                        <tr>
                            <td><input type="checkbox" value="<?=$v['id']?>" /></td>
                            <td value="<?=$v['id']?>" class="data-id"><?=$v['id']?></td>
                            <td value="<?=$v['name']?>" class="data-name"><?=$v['name']?></td>
                            <td value="<?=$v['username']?>" class="data-username"><a href="#"><?=$v['username']?></a></td>
                            <td value="<?=$v['title']?>" class="data-title"><?=$v['title']?></td>
                            <td value="<?=$v['response_times']?>" class="am-hide-sm-only data-response_times"><?=$v['response_times']?></td>
                            <td value="<?=$v['follow_numbers']?>" class="am-hide-sm-only data-follow_numbers"><?=$v['follow_numbers']?></td>
                            <td>
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs">
                                        <button class="am-btn am-btn-default am-btn-xs am-text-secondary doc_edit"><span class="am-icon-pencil-square-o"></span> 编辑</button>
                                        <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</button>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <?php } ?>
                        </tbody>
                    </table>
                    <div class="am-cf">
                        共 2 条记录
                        <div class="am-fr">
                            <ul class="am-pagination">
                                <li class="am-disabled"><a href="#">«</a></li>
                                <li class="am-active"><a href="#">1</a></li>
                                <li><a href="#">2</a></li>
                                <li><a href="#">3</a></li>
                                <li><a href="#">4</a></li>
                                <li><a href="#">5</a></li>
                                <li><a href="#">»</a></li>
                            </ul>
                        </div>
                    </div>
                    <hr />
                    <p>注：.....</p>
            </div>

        </div>
    </div>

    <!--新增医生界面 暂留不一定使用-->
    <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
        <div class="am-modal-dialog">
            <div class="am-modal-hd">Amaze UI</div>
            <div class="am-modal-bd">
                新增医生 <input type="text" class="am-modal-prompt-input">
            </div>
            <div class="am-modal-footer">
                <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                <span class="am-modal-btn" data-am-modal-confirm>提交</span>
            </div>
        </div>
    </div>
    <script>
        $('#doc-add').on('click', function() {
            $('#my-prompt').modal({
                relatedTarget: this,
                onConfirm: function(e) {
                    var $tr = $(this.relatedTarget).parent('tr');
                    alert('你输入的是：' + e.data || '')
                },
                onCancel: function(e) {
                    alert('不想说!');
                }
            });
        });
    </script>
    <!--新增医生界面-->

    <!--编辑医生界面-->
    <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt-edit">
        <div class="am-modal-dialog">
            <div class="am-modal-content">
                <div class="am-modal-hd">医生信息(新增或者编辑)</div>
                <div class="am-modal-bd">
                    <div class="am-form-group">
                        <form class="am-form am-form-horizontal">
                            <input type="hidden" name="id" class="modal-id">
                            <div class="am-form-group">
                                <label for="doc-ipt-3" class="am-u-sm-3 am-form-label">真实姓名</label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="modal-name" id="doc-ipt-3" placeholder="输入医生的真实姓名">
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label for="doc-ipt-3" class="am-u-sm-3 am-form-label">职称</label>
                                <div class="am-u-sm-9">
                                    <label>
                                        <input type="radio" name="doc-radio-1" value="option1" checked>男
                                        <input type="radio" name="doc-radio-1" value="option1">女
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label for="doc-ipt-3" class="am-u-sm-3 am-form-label">生日</label>
                                <div class="am-u-sm-9">
                                    <div class="am-form-group am-form-icon">
                                        <i class="am-icon-calendar"></i>
                                        <input type="date" class="am-form-field am-input-sm" placeholder="日期">
                                    </div>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label for="doc-ipt-3" class="am-u-sm-3 am-form-label">职称</label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="modal-title" id="doc-ipt-3" placeholder="输入医生的职称">
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label for="doc-ipt-3" class="am-u-sm-3 am-form-label">医生头像</label>
                                <div class="am-u-sm-9">
                                    <input id="file_upload" name="file_upload" type="file" multiple="true">
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label for="doc-ipt-3" class="am-u-sm-3 am-form-label"></label>
                                <div class="am-u-sm-9">
                                    <img class="am-radius" src="http://s.amazeui.org/media/i/demos/bw-2014-06-19.jpg?imageView/1/w/1000/h/1000/q/80"/>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label for="doc-ipt-3" class="am-u-sm-3 am-form-label">自我介绍</label>
                                <div class="am-u-sm-9">
                                    <div class="am-form-group am-form-icon">
                                        <textarea class="" rows="5" id="doc-ta-1"></textarea>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="am-modal-footer" style="">
                <button type="button" class="am-modal-btn " data-am-modal-cancel>取消</button>
                <button type="button" class="am-modal-btn " data-am-modal-confirm>提交</button>
            </div>
        </div>
    </div>
    <style type="text/css">
        .am-modal-hd{ margin-bottom: 10px;}
        .am-modal-bd{ height: 500px; overflow-y: scroll; text-align: left; }
        .am-modal-footer{ float: right; width:40%; }
        .am-modal-footer .am-modal-btn{ margin: 4px 4px; width: 80px; border: 1px; }
        .am-modal-footer .am-modal-btn:hover{ margin: 4px 4px; width: 80px; border: 1px; color: #fff; background: #0b6fa2; }
        .am-form img{ max-width: 300px; max-height: 200px;}
        .up{ background: #00b3ee; border: 0; position: absolute; top:8px; }
    </style>
    <script>
        //上传图片插件
        $(function(){
            $('#file_upload').uploadify({
                'swf'      : '/uploadify/uploadify.swf',    //指定上传控件的主体文件
                'uploader' : '/uploadify/uploadify.php',    //指定服务器端上传处理文件
                //其他配置项
                'buttonText' : '上传头像',
                'buttonClass' : 'up', 
            });
        });
        $('.doc_edit').on('click', function() {
            //这里弹出窗口前，获取所要显示的数据
            var temp = $(this).parent().parent().parent();
            $('.modal-name').val(temp.siblings('.data-name').attr('value'));
            $('.modal-title').val(temp.siblings('.data-title').attr('value'));

            $('#my-prompt-edit').modal({
                relatedTarget: this,
                onConfirm: function(e) {
                    var $link = $(this.relatedTarget).parent('.data-id');
                    console.log($(this));
                    console.log($link);
                    //alert('你输入的是：' + e.data || '')
                },
                onCancel: function(e) {

                }
            });
        });
    </script>
    <!--编辑医生界面-->


</div>
